﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Public;

namespace DAL
{
    public class TonGiaoDAL
    {
        

        public static List<TonGiaoPublic> LoadTonGiao()
        {
            var tongiao = Common.db.ExecuteStoreQuery<TonGiaoPublic>(@"select * from TonGiao");
            return tongiao.ToList();

            //List<TonGiaoPublic> list = new List<TonGiaoPublic>();
            //var query = from q in Common.db.TonGiaos
            //            select q;
            //foreach (var item in query)
            //{
            //    TonGiaoPublic tg = new TonGiaoPublic(item.MaTG, item.TenTonGiao);
            //    list.Add(tg);
            //}
            //return list;
        }
        public static TonGiaoPublic GetTonGiaoByMaTG(int MaTG)
        { 
            var tongiao=Common.db.ExecuteStoreQuery<TonGiaoPublic>(@"select TenTonGiao from TonGiao where MaTG="+MaTG);
            return tongiao.ToList()[0];
        }
    }
}
